package kr.hkit.powerjava.chapter12.interfaceex;

public class Box implements Comparable {
	private double volume = 0;
	
	public Box(double volume) {
		this.volume = volume;
	}
	@Override
	public int compareTo(Object other) {
		
		return (int) (this.volume - ((Box)other).volume);
	}
	
	public static void main(String[] args) {
		Box b1 = new Box(100);
		Box b2 = new Box(105.0);
		
		if(b1.compareTo(b2) > 0) {
			System.out.println("b1이 큼");
		} else if(b1.compareTo(b2) < 0) {
			System.out.println("b2가 큼");
		} else {
			System.out.println("b1과 b2는 같음");
		}
	}

}
